package com.cartoon.pictures.business.common;

/**
 * Created by chenxunlin01 on 2016/12/20.
 */

public class MethodInfo {

    private long startTime;
    private long endTime;
    private String methodName;
    private long resultSize;

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public long getEndTime() {
        return endTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public long getResultSize() {
        return resultSize;
    }

    public void setResultSize(long resultSize) {
        this.resultSize = resultSize;
    }

    public String log() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(methodName + ": \n");
        stringBuilder.append("totalTime:" + (endTime - startTime) + "ms \n");
        stringBuilder.append("resultSize:" + resultSize / 1024 +"KB");
        return stringBuilder.toString();
    }


    @Override
    public String toString() {
        return "MethodInfo{" +
                "startTime=" + startTime +
                ", endTime=" + endTime +
                ", methodName='" + methodName + '\'' +
                '}';
    }
}
